<?php

namespace common\entities\outstock;

use Yii;

/**
 * This is the model class for table "myscrm_delivery_product".
 *
 * @property integer $id
 * @property string $delivery_guid
 * @property integer $contract_type
 * @property string $application_id
 * @property string $application_name
 * @property integer $rent_period
 * @property integer $apply_num
 * @property string $project_guid
 * @property string $project_name
 * @property string $rent_start_date
 * @property string $contract_application_id
 * @property string $licensing_standards
 * @property string $settlement_amount
 * @property string $sub_order_id
 * @property string $remark
 */
class MyscrmDeliveryProductEntity extends \common\entities\ContractEntity
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'myscrm_delivery_product';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('contractDB');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['delivery_guid', 'application_id'], 'required'],
            [['contract_type', 'rent_period', 'apply_num'], 'integer'],
            [['rent_start_date'], 'safe'],
            [['settlement_amount'], 'number'],
            [['remark'], 'string'],
            [['delivery_guid', 'application_id', 'project_guid', 'contract_application_id', 'sub_order_id'], 'string', 'max' => 36],
            [['application_name'], 'string', 'max' => 45],
            [['project_name', 'licensing_standards'], 'string', 'max' => 100]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'delivery_guid' => '出库单guid',
            'contract_type' => '签约类型【1-新签，3-续签，2增购】',
            'application_id' => '应用ID',
            'application_name' => '应用名称',
            'rent_period' => '租用周期（月）',
            'apply_num' => '申请数量',
            'project_guid' => '项目GUID',
            'project_name' => '项目名称',
            'rent_start_date' => '租期开始日期',
            'contract_application_id' => '合同产品ID',
            'licensing_standards' => '授权标准',
            'settlement_amount' => '结算金额',
            'sub_order_id' => '待办guid',
            'remark' => '产品备注',
        ];
    }
}
